﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;

namespace ElingOA6_Admin_DSJCJ.BLL
{
    /// <summary>
    /// 相册类别 逻辑类
    /// </summary>
    public class AlbumCls
    {
        /// <summary>
        /// 相册类别DAL
        /// </summary>
        private DAL.AlbumCls albumClsDAL = new DAL.AlbumCls();
        public AlbumCls()
        {
        }

        /// <summary>
        /// 是否存在该记录
        /// <creator>wangl</creator>
        /// <date>2014-10-13</date>
        /// </summary>
        public bool Exists(string albumClsNo)
        {
            return albumClsDAL.Exists(albumClsNo);
        }
        
        /// <summary>
        /// 得到一个对象实体
        /// <creator>wangl</creator>
        /// <date>2014-10-11</date>
        /// </summary>
        public ElingOA6_Admin_DSJCJ.Model.AlbumCls GetModel(string albumClsNo)
        {
            return albumClsDAL.GetModel(albumClsNo);
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2014-10-11</date>
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.AlbumCls> GetModelList(string strWhere)
        {
            DataSet ds = albumClsDAL.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 增加相册类别
        /// <creator>wangl</creator>
        /// <date>2014-10-13</date>
        /// </summary>
        public void AddAlbumCls(Model.AlbumCls albumClsModel, List<string> orgUserList, string entityNo)
        {
            albumClsDAL.AddAlbumCls(albumClsModel, orgUserList, entityNo);
        }
        /// <summary>
        /// 修改相册类别
        /// <creator>wangl</creator>
        /// <date>2014-07-12</date>
        /// </summary>
        public void EditAlbumCls(Model.AlbumCls albumClsModel, List<string> orgUserList, string entityNo)
        {
            albumClsDAL.EditAlbumCls(albumClsModel, orgUserList, entityNo);
        }
        /// <summary>
        /// 删除相册类别
        /// <creator>wangl</creator>
        /// <date>2014-07-12</date>
        /// </summary>
        public void DeleteAlbumCls(string albumClsNo, string entityNo)
        {
            albumClsDAL.DeleteAlbumCls(albumClsNo, entityNo);
        }
        /// <summary>
        /// 获得数据列表
        /// <creator>wangl</creator>
        /// <date>2014-10-11</date>
        /// </summary>
        public List<ElingOA6_Admin_DSJCJ.Model.AlbumCls> DataTableToList(DataTable dt)
        {
            List<ElingOA6_Admin_DSJCJ.Model.AlbumCls> modelList = new List<ElingOA6_Admin_DSJCJ.Model.AlbumCls>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                ElingOA6_Admin_DSJCJ.Model.AlbumCls model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = albumClsDAL.DataRowToModel(dt.Rows[n]);
                    if (model != null)
                    {
                        modelList.Add(model);
                    }
                }
            }
            return modelList;
        }

    }
}
